#!/bin/bash 
# script pour prendre une image de la ip webcam
# supporte la ip webcam linksys et la d-link mais il faut definir le model
# sur la ligne ci-dessous
# valeurs cammodel="dlink" ou cammodel="linksys"
#   
#    Copyright (C) 2010  Martin Aube
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#    Contact: martin.aube@cegepsherbrooke.qc.ca
#
# 
cammodel1="dlink"
y=`date +%Y`
mo=`date +%m`svn checkout http://sand.googlecode.com/svn/trunk/
d=`date +%d`
noname=`date +%Y-%m-%d_%H:%M:%S`
cd /home/sand/public_html/cgi-bin
if [ $cammodel1 = "dlink" ]
then
list=" 100 101 102 103 104 105 106  "
for nf in $list
do /usr/bin/wget http://sand:memo123@192.168.0.$nf/IMAGE.JPG
   /bin/mv -f IMAGE.JPG $nf.jpg
   /usr/bin/convert -compress none $nf.jpg image.ppm
   
   /bin/mv -f $nf.jpg /home/flore/192.168.0.$nf/$nf-$noname.jpg
# readimg doit seulement imprimer le nombre de pixel de feuille
   /home/flore/readimg > npix.tmp
   read surface npix ntige nautre < npix.tmp
   echo $noname $nf $surface $npix $ntige $nautre >> /home/flore/evolution_s_feuille_$nf.txt
done

fi





#          /bin/echo "/usr/bin/convert -delay 25" `/bin/cat /home/sand/public_html/cgi-bin/animation |  /usr/bin/tr -d '\n' | /bin/sed 's/jpg/jpg /g'` " /home/sand/public_html/cgi-bin/tata.gif" > /home/sand/public_html/cgi-bin/animation.tmp
#          /bin/bash /home/sand/public_html/cgi-bin/animation.tmp
#/bin/mv /home/sand/public_html/cgi-bin/tata.gif /home/sand/public_html/animation.gif
#/bin/chmod a+xr  /home/sand/public_html/animation.gif

